//authorization.js
Component({
  properties: {
    modalHidden: {
      type: Boolean,
      value: false
    }
  },
  data: { 
        
  },
  methods: {
    // dynamicTit: function () {
    //    wx.setNavigationBarTitle({
    //     title: '用户授权'
    //   })
    // },
    onGotUserInfo: function () {
      var that = this;    
      wx.getSetting({
        success: (sq) => {
          if (sq.authSetting['scope.userInfo']){
            that.setData({
                modalHidden: true
            }, () => {
                wx.login({
                  success: function (re){
                    console.log(re)
                    var codes = re.code;
                    if (codes != ''){
                      wx.getUserInfo({
                        withCredentials: true,
                        success: function (res){
                            console.log(res)
                        }
                      })
                    }
                  }
                })
             })
          }
        }
      })
    }
  }
})